import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:online_study/classify/course_item.dart';
import 'package:online_study/course/course_detail.dart';
import 'package:online_study/mine/learning_history.dart';
import 'package:online_study/theme/colors.dart';
import 'package:online_study/theme/size.dart';

//我的-学习记录
class LearningRecordPage extends StatefulWidget {
  @override
  _LearningRecordPageState createState() => _LearningRecordPageState();
}

class _LearningRecordPageState extends State<LearningRecordPage> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(
          horizontal: ThemeSize.width9, vertical: ThemeSize.height6),
      padding: EdgeInsets.symmetric(horizontal: ThemeSize.width12),
      decoration: BoxDecoration(
          color: ThemeColor.colorWhite,
          borderRadius: BorderRadius.circular(ThemeSize.height8)),
      child: Column(
        children: [
          Container(
            height: ThemeSize.height40,
            child: Row(
              children: [
                Expanded(
                    child: Text("学习记录",
                        style: TextStyle(
                            color: ThemeColor.color333333,
                            fontSize: ThemeSize.sp14,
                            fontWeight: FontWeight.bold))),
                GestureDetector(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Text("查看全部",
                          style: TextStyle(
                              color: ThemeColor.color333333,
                              fontSize: ThemeSize.sp12)),
                      Container(
                          margin: EdgeInsets.only(right: ThemeSize.width9),
                          child: Icon(
                              const IconData(0xe631, fontFamily: 'IconFonts'),
                              size: ThemeSize.height12))
                    ],
                  ),
                  onTap: () {
                    Get.to(() => LearningHistoryPage());
                  },
                )
              ],
            ),
          ),
          ListView.separated(
            itemBuilder: (BuildContext context, int index) {
              return GestureDetector(
                child: CourseItemPage(true),
                onTap: () {
                  Get.to(() => CourseDetailPage());
                },
              );
            },
            separatorBuilder: (BuildContext context, int index) {
              return Divider(height: ThemeSize.width1);
            },
            itemCount: 6,
            physics: NeverScrollableScrollPhysics(),
            shrinkWrap: true,
          )
        ],
      ),
    );
  }
}
